perm filename SECT.POX[POX,WD]3 blob sn#403846 filedate 1978-12-07 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	\|\\				Define Brick Character
C00020 ENDMK
C⊗;
\|\\;				Define Brick Character
\;
\⊂'000040;\;	VERREM - REM's syntax for defining macros with args 
\;
\;			       Global Q-registers
\;
\	;\←'0;\→F\;	formula numbers
\	;\←'0;\→J\;	figure numbers
\	;\←'0;\→S\;	section numbers
\	;\←'0;\→T\;	subsection numbers
\	;\←'0;\→U\;	page number within a section
\∞PAGNUM[0]\;		page numbers
\;
\;
\;				 Dynamic Flags
\;
\∞INSECFLAG[\←=0;]\;	inside a section ?
\;
\;	       Formula and Figure Definition and Reference Macros
\;
\∞HYPHEN[-]\;
\;
\∞PERIOD[.]\;
\;
\∞SPACE[ \-=1;]\;		print space and decrement ac
\;
\;
\;				    Formulas
\;
\8FORM(NAME)[\P\N					save ac
\	;\←F\+=1;\→F\N					increment form num
\	;\R(\DF)\N					print form num on right
\	;\!EVAL((\∞)⊗NAME⊗(FORMSECNUM[)\DS(]));\N	record secnum
\	;\!EVAL((\∞)⊗NAME⊗(FORMNUM[)\DF(]));\N	record formnum
\	;\p]\;							restore ac
\;
\8REFFORM(NAME)[\P\N					save ac
\	;(\N						print "("
\N\	;\←S\N						load cur sect num
\N\	;\!EVAL((\-=)\!FORMSECNUM(⊗NAME⊗);(;));\N	if ≠ form's sec num
\N\	;\?FORMSECNUM(⊗NAME⊗);\?PERIOD;\N		then print form's secnum
\	;\!FORMNUM(⊗NAME⊗);\N				print formnum
\	;)\N						print ")"
\	;\p]\;							restore ac
\;
\8FORREFFORM(NAME,SECNUM,FORMNUM)[\P\N			save ac
\	;(\N						print "("
\	;\←S\N						load cur sect num
\	;\!EVAL((\-=)⊗SECNUM⊗(;));\N			if ≠ form's sec num
\	;\?EVAL(⊗SECNUM⊗);\?PERIOD;\N			then print form's secnum
\	;⊗FORMNUM⊗\N					print formnum
\	;)\N						print ")"
\	;\p]\;							restore ac
\;
\8FORMSECNUM(NAME)[\!⊗NAME⊗FORMSECNUM;]\;
\;
\8FORMNUM(NAME)[\!⊗NAME⊗FORMNUM;]\;
\;
\;
\;				    Figures
\;
\8FIG(NAME,CAPT)[\P\N					save ac
\	;\←J\+=1;\→J\N					increment fig num
\	;\!FIGCAPT(⊗CAPT⊗);\N		caption and fig num
\	;\!EVAL((\∞)⊗NAME⊗(FIGSECNUM[)\DS(]));\N	record fig's sect num
\	;\!EVAL((\∞)⊗NAME⊗(FIGNUM[)\DJ(]));\N		record fig num
\	;\p]\;							restore ac
\;
\8EXTFIG(NAME,HEIGHT,CAPT)[\N	space and caption for external figure
\	;\P\N				save ac
\	;\!FIGSPACE(⊗HEIGHT⊗);\N	leave room for fig
\	;\←J\+=1;\→J\N			increment fig num
\	;\!FIGCAPT(⊗CAPT⊗);\N		caption and fig num
\	;\!EVAL((\∞)⊗NAME⊗(FIGSECNUM[)\DS(]));\N
\	;\N				record fig's sect num
\	;\!EVAL((\∞)⊗NAME⊗(FIGNUM[)\DJ(]));\N
\	;\N				record fig num
\	;\p]\;				restore ac
\;
\8FIGSPACE(PIXELS)[\N		figure space macro
\	;\P\Q,\N			save ac and comma
\	;\←=⊗PIXELS⊗;\N			load # of pixels to skip
\	;\+,\N				add comma
\	;\→,\N				store result in comma
\	;\A=32;\N			print a space
\	;\q,\p\;]\;			restore comma and ac
\;
\8FIGCAPT(CAPT)[\C Fig. \DJ. ⊗CAPT⊗.]\;		figure caption and number
\;
\8REFFIG(NAME)[\P\N					save ac
\	;\!EVAL((\==3;{)\A=13;\A=10;(}));\N		***DEBUG
\	;\!EVAL((\==3;{)\!PAGNUM;( }));\N		***DEBUG
\	;\==3;{⊗NAME⊗ }\N				***DEBUG
\	;\!EVAL((\==3;{)\!FIGNUM(⊗NAME⊗);(}));\N	***DEBUG
\	;\!EVAL((\==3;{)\A=13;\A=10;(}));\N		***DEBUG
\N\	;Fig. \N					print "Fig. "
\N\	;\←S\N						load cur sect num
\N\	;\!EVAL((\-=)\!FIGSECNUM(⊗NAME⊗);(;));\N	if ≠ fig's secnum
\N\	;\?FIGSECNUM(⊗NAME⊗);\?PERIOD;\N		print fig's secnum
\	;\!FIGNUM(⊗NAME⊗);\N				print fignum
\	;\p]\;						restore ac
\;
\8FORREFFIG(NAME,SECNUM,FIGNUM)[\P\N			save ac
\	;Fig. \N					print "Fig. "
\	;\←S\N						load cur sect num
\	;\!EVAL((\-=)⊗SECNUM⊗(;));\N			if ≠ fig's secnum
\	;\?EVAL(⊗SECNUM⊗);\?PERIOD;\N			print fig's secnum
\	;⊗FIGNUM⊗\N					print fignum
\	;\p]\;						restore ac
\;
\8FIGSECNUM(NAME)[\!⊗NAME⊗FIGSECNUM;]\;
\;
\8FIGNUM(NAME)[\!⊗NAME⊗FIGNUM;]\;
\;
\;
\;                           Section Macros
\;
\!EVAL((\∞)(SKIPPAGE[)\A=32;\A=13;\A=10;\A=12;(]));\N
\;
\8SECT(NAME,TIT)[\N		section macro
\	;\P\Q0\N			save ac and reg 0
\	;\!LOADAC(PAGNUM);\N		load ac with pagnum
\	;\!ISACODD;\N			if ac is odd
\	;\?SKIPPAGE;\N			then skip a page
\	;\!RESETDAYTIME;\N		when last edited
\	;\∂←INSECFLAG;\N		expunge old INSECFLAG
\	;\∞INSECFLAG[\←=1;]\N		turn on INSECFLAG
\	;\←S\+=1;\→S\N			increment section number
\	;\←'0;\→U\N			set local page # to 0
\N\	;\←'0;\→F\N			set formula # to 0
\N\	;\←'0;\→J\N			set illustration # to 0
\	;\←'0;\→T\N			set subsec # to 0
\	;\F1\N				reset font to #1
\	;\!EVAL((\∞)⊗NAME⊗(SECNUM[)\DS(]));\N
\	;\N				store section #
\	;\!EVAL((\m{)\A=13;\A=10;(}));\N
\	;\!EVAL((\m{)\!ROMAN(\DS);( - )\N
\N\		    ;\!CAPALL(⊗TIT⊗);(     )\N
\		    ;⊗TIT⊗(     )\N
\		    ;\!LOADAC(PAGNUM);\+=1;\D∀\N
\		    ;(}));\N		type sect title
\	;\←=79;\N			screenwidth to ac
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(\!ROMAN(\DS););\N	length of secnum to ac
\	;\¬0\N				sub from screenwidth
\	;\-=3;\N			sub length of " - "
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(⊗TIT⊗);\N		length of title to ac
\	;\¬0\N				sub from screenwidth
\	;\-=5;\N			sub length of skip to pagnum
\	;\→0\N				store ac in reg 0
\	;\!LOADAC(PAGNUM);\N		page num to ac
\	;\+=1;\N			since everypage will add one
\	;\!LENGTH(\D∀);\N		length of page num to ac
\	;\¬0\N				sub from screenwidth
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(\!FILDAYTIME;);\N	length of date&time to ac
\	;\¬0\N				sub from screenwidth
\	;\!EVAL((\m{)\ISPACE;\!FILDAYTIME;(}));\N
\	;\N				date&time of last section edit
\	;\!EVAL((\m{)\A=13;\A=10;(}));\N
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\!EVAL((\==1;{)\!ROMAN(\DS);(.)(}));\N
\	;\!LENGTH(\!ROMAN(\DS););\N	length of secnum to ac
\	;\¬=8;\N			sub from indentation
\	;\-=1;\N			sub1 for "."
\N\	;\!EVAL((\==1;{)\ISPACE;\!CAPALL(⊗TIT⊗);(}));\N
\	;\!EVAL((\==1;{)\ISPACE;⊗TIT⊗(}));\N
\	;\!EVAL((\==1;{)( \"\R )(}));\N
\	;\!EVAL((\==1;{)\!LOADAC(PAGNUM);\+=1;\D∀(}));\N
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\C\#\F5Section \!ROMAN(\DS); - ⊗TIT⊗\G\N
\	;\N				print section header
\	;\q0\p]\;			restore reg 0 and ac
\;
\;
\;			 Odd (unnumbered) Section Macro
\;
\8ODDSEC(NAME,TIT)[\N		unumbered section macro
\	;\P\Q0\N			save ac and reg 0
\	;\!RESETDAYTIME;\N		when last edited
\N\	;\∂←INSECFLAG;\N		expunge old INSECFLAG
\N\	;\∞INSECFLAG[\←=1;]\N		turn on INSECFLAG
\	;\←'0;\→U\N			set local page # to 0
\	;\←'0;\→F\N			set form # to 0
\	;\←'0;\→J\N			set illustration # to 0
\	;\←'0;\→T\N			set subsec # to 0
\	;\F1\N				reset font to #1
\	;\!LOADAC(PAGNUM);\N		load ac with pagnum
\	;\!ISACODD;\N			if ac is odd
\	;\?SKIPPAGE;\N			then skip a page
\	;\!EVAL((\m{)\A=13;\A=10;(}));\N
\N\	;\!EVAL((\m{)\!CAPALL(⊗TIT⊗);(     )\N
\	;\!EVAL((\m{)⊗TIT⊗(     )\N
\	;\N				type sect title
\		    ;\!LOADAC(PAGNUM);\+=1;\D∀\N
\		    ;(}));\N
\N\	;\!EVAL((\m{)\!CAPALL(⊗TIT⊗);(	)(}));\N
\N\	;\!EVAL((\m{)⊗TIT⊗(	)(}));\N
\N\	;\!EVAL((\m{)\!LOADAC(PAGNUM);\+=1;\D∀\N(}));\N
\	;\←=79;\N			screenwidth to ac
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(⊗TIT⊗);\N		length of title to ac
\	;\¬0\N				sub from screenwidth
\	;\-=5;\N			sub length of skip to pagnum
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(\!PAGNUM;);\N		length of pagenum to ac
\	;\¬0\N				sub from screenwidth
\	;\→0\N				store ac in reg 0
\	;\!LENGTH(\!FILDAYTIME;);\N	length of date&time to ac
\	;\¬0\N				sub from screenwidth
\	;\!EVAL((\m{)\ISPACE;\!FILDAYTIME;(}));\N
\	;\!EVAL((\m{)\A=13;\A=10;(}));\N
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\N\	;\!EVAL((\==1;{)\!CAPALL(⊗TIT⊗);(}));\N
\	;\!EVAL((\==1;{)⊗TIT⊗(}));\N	put title in contents
\	;\!EVAL((\==1;{)( \"\R )(}));\N
\	;\!EVAL((\==1;{)\!LOADAC(PAGNUM);\+=1;\D∀(}));\N
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\C\#\F5⊗TIT⊗\G\N		print section header
\	;\q0\p]\;			restore ac and reg 0
\;
\;			    Section Reference Macro
\;
\8REFSEC(NAME)[\!ROMAN(\!SECNUM(⊗NAME⊗););]\;		print sect num
\;
\;
\8FORREFSEC(NAME,NUMBER)[\!ROMAN(⊗NUMBER⊗);]\;		print sect num
\;
\;
\;			      End of Section Macro
\;
\∞ENDSEC[\∂←INSECFLAG;\∞INSECFLAG[\←=0;]]\;		turn off INSECFLAG
\;
\8SECNUM(NAME)[\!⊗NAME⊗SECNUM;]\;
\;
\;
\8SUBSEC(NAME,TIT)[\P\N					save ac
\	;\←T\+=1;\→T\N					increment subsec #
\	;\!EVAL((\∞)⊗NAME⊗(SUBSECSECNUM[)\DS(]));\N	store section #
\	;\!EVAL((\∞)⊗NAME⊗(SUBSECNUM[)\DT(]));\N	store subsec #
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\←=16;\N					length of indent to ac
\N\	;\!EVAL((\==1;{)\ISPACE;\!CAPALL(⊗TIT⊗);(}));\N
\	;\!EVAL((\==1;{)\ISPACE;⊗TIT⊗(}));\N
\	;\!EVAL((\==1;{)( \"\R )(}));\N
\	;\!EVAL((\==1;{)\!PAGNUM;(}));\N
\	;\!EVAL((\==1;{)\A=13;\A=10;(}));\N
\	;\#\F2\!LETTER(\DT);. \!CAPFIRST(⊗TIT⊗);.\G\N	print subsec head
\N\	;\#\F2\!LETTER(\DT);. ⊗TIT⊗.\G\N		print subsec head

\	;\p]\;						restore ac
\;
\8REFSUBSEC(NAME)[\P\N					save ac
\	;\←S\N						get cur sec num
\	;\!EVAL((\-=)\!SUBSECSECNUM(⊗NAME⊗);(;));\N	if ≠ named sec num
\	;\?ROMAN(\!SUBSECSECNUM(⊗NAME⊗););\?HYPHEN;\N	then print sect num
\	;\!LETTER(\!SUBSECNUM(⊗NAME⊗););\N		print subsec num
\	;\p]\;							restore ac
\;
\8FORREFSUBSEC(NAME,SECNUM,SUBSECNUM)[\P\N		save ac
\N\	;\←S\N						get cur sec num
\N\	;\!EVAL((\¬=)⊗SECNUM⊗(;));\N			if ≠ named sec num
\	;\←=⊗SECNUM⊗;\N					get named sec num
\	;\-S\N						if = cur sec num
\	;\?ROMAN(⊗SECNUM⊗);\?HYPHEN;\N			then print sect num
\	;\!LETTER(⊗SUBSECNUM⊗);\N			print subsec num
\	;\p]\;							restore ac
\;
\8SUBSECNUM(NAME)[\!⊗NAME⊗SUBSECNUM;]\;
\;
\8SUBSECSECNUM(NAME)[\!⊗NAME⊗SUBSECSECNUM;]\;
\;
\∞UNWRITTENSUBSECSECNUM[0]\;
\∞UNWRITTENSUBSECNUM[0]\;
\;
\;
\;				Running Title Macro
\;
\8RUNTIT(TIT)[\P\N			save ac
\	;\!RUNTITFLAG;\N		load run tit flag into ac
\	;\?IFRUNTIT((⊗TIT⊗));\N		do ifruntit macro
\	;\p\;]\;			restore ac
\;
\;\8IFRUNTIT(TIT)[\N
\8IFRUNTIT(TIT)[\!EVAL((\==1;{
			)⊗TIT⊗(
)(}));\N				put running title in cont
\#\F2⊗TIT⊗\G]\;				print running title
\;
\;
\;				  Summary Macro
\;
\8SUMMARY(STR)[\P\!SUMMARYFLAG;\?IFSUMMARY((⊗STR⊗));\p\;]\;
\8IFSUMMARY(STR)[\P\Qε\Qλ\←=0;\→ε\ε\←=5;\→λ\λ\QL\QR\←L\+=160;\→L\←R\-=120;\→R\#\F0\N
	.	.	.	.	.	.	.	.	.
\J ⊗STR⊗ \.
.	.	.	.	.	.	.	.	.
\G\qR\qL\qλ\←λ\λ\qε\←ε\ε\p]\;
\;
\;
\;				  Remark Macro
\;
\8REMARK(STR)[\P\!REMARKFLAG;\?IFREMARK((⊗STR⊗));\p\;]\;
\8IFREMARK(STR)[\P\Qε\Qλ\gε\→ε\←=0;\ε\gλ\→λ\←=5;\λ\QL\QR\←L\+=160;\→L\←R\-=120;\→R\#\F0\N
	*	*	*	*	*	*	*	*	*
\J ⊗STR⊗ \.
*	*	*	*	*	*	*	*	*
\G\qR\qL\←λ\λ\←ε\ε\qλ\qε\p\;]\;
\;
\;
\;				  Ednote Macro
\;
\8EDNOTE(STR)[\P\!EDNOTEFLAG;\?IFEDNOTE((⊗STR⊗));\p\;]\;
\8IFEDNOTE(STR)[\P\Qε\Qλ\gε\→ε\←=0;\ε\gλ\→λ\←=5;\λ\QL\QR\←L\+=160;\→L\←R\-=120;\→R\#\F0\N
	*****************************************************************
\J EDITOR: ⊗STR⊗ \.
*****************************************************************
\G\qR\qL\←λ\λ\←ε\ε\qλ\qε\p]\;
\;
\;
\;				  Footnote Macro
\;
\8FOOTNOTE(STR)[\P\Qε\Qλ\gε\→ε\←=0;\ε\gλ\→λ\←=5;\λ\QL\QR\←L\+=160;\→L\←R\-=120;\→R\#\F0\N
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\J FOOTNOTE: ⊗STR⊗ \.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\G\qR\qL\←λ\λ\←ε\ε\qλ\qε\p]\;
\;				Note Macro
\;
\8NOTE(STR)[\N
\	;\!EVAL((\==2;{)\A=13;\A=10;(}));\N
\	;\==2;{\"\!PRINTNOTE(}\N
\	;\!EVAL((\==2;{)\!PAGNUM;(,}));\N
\	;\==2;{((⊗STR⊗)));}\N
\	;\!EVAL((\==2;{)\A=13;\A=10;(}));\N
\	;]\;
\;
\8PRINTNOTE(PAGE,NOTE)[\N
\	;\!FMTREF(PAGE \!NUMJUST(⊗PAGE⊗ ,\!LENGTH(\!PAGNUM;);); ,\N
\		 ;⊗NOTE⊗);\N
\	;]\;
\;
\8NUMJUST(NUM,WIDTH)[\N
\	;\P\Q0\N
\	;\!LENGTH(⊗NUM⊗);\N
\	;\→0\N				store in 0
\	;\←=⊗WIDTH⊗;\N
\	;\-0\N
\	;\ISPACE;\N
\	;⊗NUM⊗\N
\	;\q0\p]\;
\;